package edu.avans.hartigehap.service.jpa;

import java.util.*;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.*;
import org.springframework.stereotype.Repository;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import edu.avans.hartigehap.domain.*;
import edu.avans.hartigehap.domain.decorator.TestIngredient;
import edu.avans.hartigehap.repository.*;
import edu.avans.hartigehap.service.*;
import com.google.common.collect.Lists;
import org.joda.time.DateTime;

@Service("testIngredientService")
@Repository
@Transactional
public class TestIngredientServiceImpl implements TestIngredientService {
	final Logger logger = LoggerFactory.getLogger(TestIngredientServiceImpl.class);
	
	@Autowired
	private TestIngredientRepository testIngredientRepository;

	@Transactional(readOnly=true)
	public List<TestIngredient> findAll() {
		return Lists.newArrayList(testIngredientRepository.findAll());
	}

	@Transactional(readOnly=true)
	public TestIngredient findById(String restaurant) {
		return testIngredientRepository.findOne(restaurant);
	}
	
	public TestIngredient save(TestIngredient ingredient) {
		return testIngredientRepository.save(ingredient);
	}

	public void delete(String ingredient) {
		testIngredientRepository.delete(ingredient);
	}

	@Transactional(readOnly=true)
	public Page<TestIngredient> findAllByPage(Pageable pageable) {
		return testIngredientRepository.findAll(pageable);
	}
	
	
	
}
